package com.linx.kafka.config.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/***
 * @ClassName KafkaProperties
 * @Description TODO
 * @Author gushaoliang
 * @Date 2024/11/27 下午2:24
 * @Version 1.0
 */
@Data
@ConfigurationProperties(prefix = "spring.kafka")
public class KafkaProperties {

    private String bootstrapServers;

    private Producer producer; // Kafka 生产者配置

    private Consumer consumer; // Kafka 消费者配置


    @Data
    public static class Producer {
        private String keySerializer; // 键的序列化器
        private String valueSerializer; // 值的序列化器
        private Integer retries; // 重试次数
        private Integer batchSize; // 批量大小
        private Integer lingerMs; // 延迟时间
        private Integer bufferMemory; // 缓冲区内存大小
    }

    @Data
    public static class Consumer {
        private String keyDeserializer; // 键的反序列化器
        private String valueDeserializer; // 值的反序列化器
        private Integer maxPollRecords; // 每次拉取的最大记录数
        private Integer maxPollIntervalMs; // 拉取间隔
        private Integer sessionTimeoutMs; // 会话超时时间
        private Integer heartbeatIntervalMs; // 心跳间隔
    }

}
